package com.lanou3g.zjl.chating.base;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;

import com.lanou3g.zjl.chating.base.ActivityControl;

import butterknife.ButterKnife;

/**
 * Created by dllo on 15/11/17.
 */
public abstract class BaseActivity extends FragmentActivity {

    protected String tag = getClass().getSimpleName();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getLayout());
        //初始化依赖注入
        ButterKnife.bind(this);
        ActivityControl.addAty(tag, this);
        //初始化数据
        initData();
    }
    /**
     * 返回值为所要加载的布局文件
     * @return
     */
    protected abstract int getLayout();

    /**
     * 初始化数据
     */
    protected abstract void initData();

    @Override
    protected void onDestroy() {
        super.onDestroy();
        ActivityControl.removeAty(tag);
    }

}
